#!/bin/bash
#
# Usage:
#   ./do.sh <action>

banner() {
  echo 1>&2
  echo 1>&2 --- $@ ---
  echo 1>&2
}

# command line tool
tnet() {
  PYTHONPATH=.. ../bin/tnet.py "$@"
}

build-example() {
  set -o errexit

  ghc --make -o example/pages example/Pages.hs
}

clean-example() {
  pushd example > /dev/null
  rm *.o *.hi pages
  popd >/dev/null
}

run-example() {
  set -o errexit

  build-example

  ~/polyweb/bin/dev_server.sh --live-root .

  clean-example
}

"$@"
